﻿using System;
using RG.Common.WPF.Commands;

namespace RG.Common.WPF.BaseFrame
{
    public class BaseButton : ToolbarButton
    {
        protected virtual void Init()
        {
            VisibleFlag = "IsVisible";
        }

        public BaseButton(Action action, Func<bool> isActive)
        {
            Command = new DelegateCommand(action, isActive);
            Init();
        }

        public BaseButton(Action action)
        {
            Command = new DelegateCommand(action);
            Init();
        }
    }

    public class RefreshButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Обновить";
            ToolTipText = "Обновить";
            ImagePath = ToolBarIcon.RefreshIcon;
        }

        public RefreshButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public RefreshButton(Action action)
            : base(action) { }
    }

    public class SaveButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Сохранить";
            ToolTipText = "Сохранить";
            ImagePath = ToolBarIcon.SaveIcon;
        }

        public SaveButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public SaveButton(Action action)
            : base(action) { }
    }

    public class SaveAllButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Сохранить всё";
            ToolTipText = "Сохранить всё";
            ImagePath = ToolBarIcon.SaveAllIcon;
        }

        public SaveAllButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public SaveAllButton(Action action)
            : base(action) { }
    }

    public class CreateButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Создать";
            ToolTipText = "Создать";
            ImagePath = ToolBarIcon.NewDocIcon;
        }
        public CreateButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public CreateButton(Action action)
            : base(action) { }
    }

    public class EditButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Редактировать";
            ToolTipText = "Редактировать";
            ImagePath = ToolBarIcon.EditIcon;
        }
        public EditButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public EditButton(Action action)
            : base(action) { }
    }

    public class ApproveButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Утвердить";
            ToolTipText = "Утвердить";
            ImagePath = ToolBarIcon.CheckMarkIcon;
        }
        public ApproveButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public ApproveButton(Action action)
            : base(action) { }
    }


    public class AddButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Добавить";
            ToolTipText = "Добавить";
            ImagePath = ToolBarIcon.AddIcon;
        }
        public AddButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public AddButton(Action action)
            : base(action) { }
    }

    public class DeleteButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Удалить";
            ToolTipText = "Удалить";
            ImagePath = ToolBarIcon.DeleteIcon;
        }
        public DeleteButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public DeleteButton(Action action)
            : base(action) { }
    }

    public class ExcelButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Excel";
            ToolTipText = "Excel";
            ImagePath = ToolBarIcon.ExcelIcon;
        }
        public ExcelButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public ExcelButton(Action action)
            : base(action) { }
    }

    public class PrintButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Печать";
            ToolTipText = "Печать";
            ImagePath = ToolBarIcon.PrintPreviewIcon;
        }
        public PrintButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public PrintButton(Action action)
            : base(action) { }
    }

    public class HistoryButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "История";
            ToolTipText = "История";
            ImagePath = ToolBarIcon.HistoryIcon;
        }
        public HistoryButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public HistoryButton(Action action)
            : base(action) { }
    } 
    public class ImagesButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Картинки";
            ToolTipText = "Картинки";
            ImagePath = ToolBarIcon.ShowFileIcon;
        }
        public ImagesButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public ImagesButton(Action action)
            : base(action) { }
    } 
    
    public class ChangeButton : BaseButton
    {
        protected override void Init()
        {
            base.Init();
            Header = "Изменить";
            ToolTipText = "Изменить";
            ImagePath = ToolBarIcon.ChangeIcon;
        }
        public ChangeButton(Action action, Func<bool> isActive)
            : base(action, isActive) { }

        public ChangeButton(Action action)
            : base(action) { }
    }
}
